
export const createStore = (reducer, enhancer) => {
    let currentState = {}
    let currentListerers = []

    const getState = () => {
        return currentState
    }
    const subscribe = (listener) => {
        currentListerers.push(listener)
    }
    const dispatch = (action) => {
        currentState = reducer(currentState, action)
        currentListerers.forEach(v => v())
        return action
    }
    dispatch({ type: '@MyRedux_init' })
    return {
        dispatch,
        subscribe,
        getState,
    }
}
